/**
 * Copyright 2009 Joe LaPenna
 */

package com.ruiyi.http;

import org.apache.http.NameValuePair;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpRequestBase;

import com.ruiyi.baseparser.Parser;
import com.ruiyi.baseparser.RuiyiType;
import com.ruiyi.error.RuiyiCredentialsException;
import com.ruiyi.error.RuiyiException;
import com.ruiyi.error.RuiyiParseException;

import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;

/**
 * @author Joe LaPenna (joe@joelapenna.com)
 */
public interface HttpApi {

	abstract public RuiyiType doHttpRequest(HttpRequestBase httpRequest,
			Parser<? extends RuiyiType> parser)
			throws RuiyiCredentialsException, RuiyiParseException,
			RuiyiException, IOException;

	abstract public String doHttpPost(String url,
			NameValuePair... nameValuePairs) throws RuiyiCredentialsException,
			RuiyiParseException, RuiyiException, IOException;

	abstract public HttpGet createHttpGet(String url,
			NameValuePair... nameValuePairs);

	abstract public HttpPost createHttpPost(String url,
			NameValuePair... nameValuePairs);

	abstract public HttpURLConnection createHttpURLConnectionPost(URL url,
			String boundary) throws IOException;
}